package edu.tju.honour;

import java.sql.SQLException;

import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.younker.waf.db.IBatisConfig;


public class IbatisClassHonourDao implements IClassHonourDao{
	protected SqlMapClient sqlMap = IBatisConfig.getSqlMapInstance();



	@Override
	public void deleteClassHonour(long id) throws SQLException {
		sqlMap.delete("deleteClassHonour", id);
		
	}

	@Override
	public List<ClassHonour> getClassHonourAnd(ClassHonour classHonour) throws SQLException {
		return sqlMap.queryForList("getClassHonourAnd", classHonour);
	}

	@Override
	public ClassHonour getClassHonourById(long id) throws SQLException {
		return (ClassHonour) sqlMap.queryForObject("getClassHonourById", id);
	}

	@Override
	public List<ClassHonour> getClassHonourOr(ClassHonour classHonour) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Long insertClassHonour(ClassHonour classHonour) throws SQLException {
		return (Long)sqlMap.insert("insertClassHonour", classHonour);
	}

	@Override
	public int updateClassHonour(ClassHonour classHonour) throws SQLException {
		return sqlMap.update("updateClassHonour", classHonour);
	}

}
